/*
 * 版权所有 (c) 2022-2099 TBIT。保留所有权利。
 */

package com.tbit.uqbike.service.business.impl;

import com.tbit.uqbike.constant.MapConstant;
import com.tbit.uqbike.object.business.Point;
import com.tbit.uqbike.service.base.impl.CalibrateServiceImpl;

import java.util.List;

/**
 * @author <a href="mailto:li.yao@tbit.com.cn">yao</a>
 * @version 4.2.0
 * @since 2024/9/23 15:16
 */
public final class PointConvertUtil {

    public static Point getCenterLatLngC(Double centerLng, Double centerLat) {
        CalibrateServiceImpl calibrateService = new CalibrateServiceImpl();
        return calibrateService.calibrateRecerseOffSet(centerLng, centerLat, MapConstant.MAP_GOOGLE);
    }

    public static String getPoints(List<Double[]> pointlist) {
        StringBuilder sb = new StringBuilder();
        for (Double[] points : pointlist) {
            sb.append(points[0]).append(",").append(points[1]).append(";");
        }
        sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }

    public static String getPointsC(List<Double[]> pointlist) {
        CalibrateServiceImpl calibrateService = new CalibrateServiceImpl();
        StringBuilder sb = new StringBuilder();
        for (Double[] points : pointlist) {
            Point point = calibrateService.calibrateRecerseOffSet(points[0], points[1], MapConstant.MAP_GOOGLE);
            sb.append(point.getX()).append(",").append(point.getY()).append(";");
        }
        sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }

}
